<!-- BEGIN: Subheader -->
<div class="m-subheader">
    <div class="d-flex align-items-center">
        <div class="mr-auto">
            <h3 class="m-subheader__title">
                系统日志
            </h3>
            <ul class="m-subheader__breadcrumbs m-nav m-nav--inline">
                <li class="m-nav__item m-nav__item--home">
                    <a href="#" class="m-nav__link m-nav__link--icon">
                        <i class="m-nav__link-icon la la-home"></i>
                    </a>
                </li>
            </ul>
        </div>
        <div>
        </div>
    </div>
</div>
<!-- END: Subheader -->

<div class="m-content">

    <div class="m-portlet m-portlet--mobile">
        <div class="m-portlet__head">
            <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                    <h3 class="m-portlet__head-text">
                        修改 [<b *ngIf="account">{{account.loginId}}</b>] 密码
                    </h3>
                </div>
            </div>
            <div class="m-portlet__head-tools">
            </div>
        </div>
        <div class="m-portlet__body">

            <div>
                <div class="row justify-content-center">
                    <div class="col-md-8">

                        <div class="alert alert-success" *ngIf="success">
                            <strong>密码修改成功</strong>
                        </div>
                        <div class="alert alert-danger" *ngIf="error" >
                            {{error}}
                        </div>

                        <form name="form" role="form" (ngSubmit)="changePassword()" #passwordForm="ngForm">
                            <div class="form-group">
                                <label class="form-control-label" for="password">原密码</label>
                                <input type="password" class="form-control" id="oldPassword" name="oldPassword" #passwordInput="ngModel"
                                       placeholder="请输入原密码"
                                       [(ngModel)]="oldPassword" minlength=4 maxlength=50 required>
                            </div>
                            <div class="form-group">
                                <label class="form-control-label" for="password">新密码</label>
                                <input type="password" class="form-control" id="password" name="password" #passwordInput="ngModel"
                                placeholder="请输入新密码"
                                       [(ngModel)]="password" minlength=6 maxlength=64 required>
                                <div *ngIf="passwordInput.dirty && passwordInput.invalid">
                                    <small class="form-text text-danger"
                                       *ngIf="passwordInput.errors.required" >
                                        新密码是必填项
                                    </small>
                                    <small class="form-text text-danger"
                                       *ngIf="passwordInput.errors.minlength">
                                        新密码至少6个字符串
                                    </small>
                                    <small class="form-text text-danger"
                                       *ngIf="passwordInput.errors.maxlength" jhiTranslate="global.messages.validate.newpassword.maxlength">
                                        新密码至少64个字符串
                                    </small>
                                </div>
                                <jhi-password-strength-bar [passwordToCheck]="password"></jhi-password-strength-bar>
                            </div>
                            <div class="form-group">
                                <label class="form-control-label" for="confirmPassword">确认新密码</label>
                                <input type="password" class="form-control" id="confirmPassword" name="confirmPassword" #confirmPasswordInput="ngModel"
                                placeholder="请再次输入新密码"
                                       [(ngModel)]="confirmPassword" minlength=4 maxlength=50 required>
                                <div *ngIf="confirmPasswordInput.dirty && confirmPasswordInput.invalid">
                                    <small class="form-text text-danger"
                                       *ngIf="confirmPasswordInput.errors.required">

                                        确认新密码是必填项
                                    </small>
                                    <small class="form-text text-danger"
                                       *ngIf="confirmPasswordInput.errors.minlength">
                                        确认新密码至少6个字符串
                                    </small>
                                    <small class="form-text text-danger"
                                       *ngIf="confirmPasswordInput.errors.maxlength">
                                        确认新密码至少64个字符串
                                    </small>
                                </div>
                            </div>

                            <button type="submit" [disabled]="passwordForm.form.invalid" class="btn btn-primary">保存</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
